﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;


namespace popGis
{
    public partial class AttributeForm : Form
    {
        public ILayer m_Layer;
        public DataTable attributeTable;

        /// <summary>
        /// 图层属性表窗体构造方法，须传入图层
        /// </summary>
        /// <param name="_Layer">图层</param>
        public AttributeForm(ILayer _Layer)
        {
            InitializeComponent();
            m_Layer = _Layer;
        }

        private void AttributeForm_Load(object sender, EventArgs e)
        {
            CreateAttributeTable();
        }

        public void CreateAttributeTable()
        {
            string tableName;
            tableName = DataConvertion.getValidFeatureClassName(m_Layer.Name);
            attributeTable = AttributDataTable.CreateDataTable(m_Layer, tableName);
            //将属性表数据绑定到dataGridView控件
            this.dataGridView1.DataSource = attributeTable;
            this.Text = "属性表[" + tableName + "] " + "记录数：" + attributeTable.Rows.Count.ToString();
        }

    }
}
